package com.cqw.commontest.lambda;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-06-01 10:28
 * @Description: 刷选
 */
public class StreamTest1 {


    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 7, 8);

        List<Integer> collect = list.stream().filter(t -> t > 6).collect(Collectors.toList());


        List<Person> personList = new ArrayList<>();
        personList.add(new Person("张三", 1000, 21, "男", "上海"));
        personList.add(new Person("李四", 2000, 25, "女", "安徽"));
        personList.add(new Person("王五", 2200, 36, "男", "杭州"));
        personList.add(new Person("赵六", 1400, 25, "女", "南京"));
        personList.add(new Person("曹七", 3000, 12, "男", "北京"));
        personList.add(new Person("Lily", 5000, 42, "女", "上海"));

        //筛选工资高于2000的人
        List<Person> personList1 = personList.stream().filter(person -> person.getSalary() > 2000).collect(Collectors.toList());

    }


}
